import pandas as pd
from datasets import Dataset

def main():
    # 读取 Excel 文件
    data = pd.read_excel(r'C:\Users\23248\PycharmProjects\stance\StanceDetectionLab\lab1\data\train_data\train_data.xlsx')

    # 将 Pandas DataFrame 转换为 Hugging Face Dataset
    dataset = Dataset.from_pandas(data)

    # 查看 Dataset
    print(dataset)
    print(dataset[0])  # 查看第一条数据

    # 保存 Dataset 到本地
    dataset.save_to_disk(r'C:\Users\23248\PycharmProjects\stance\StanceDetectionLab\lab1\data\train_data')
if __name__ == '__main__':
    main()